package com.hy.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import com.hy.domain.News;

@Controller
public class NewPlaceController {
	
	@RequestMapping("/hycs/view/{id}")
	public String hycs(@PathVariable long id, Model model) {
		News news = News.findNews(id);
		//更新点击率
		news.setHits(news.getHits() + 1);
		news.merge(); 
		
		model.addAttribute("news", news);
		model.addAttribute("up", news.getUp());
		model.addAttribute("next", news.getNext());
		return "hycs_xq";
	}
	
}
